package org.springframework;

import org.springframework.ApplicationContext.MyselfClassPathXmlApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.dto.JmUser;
import org.springframework.event.MyselfEvent;

/**
 * @author Jeremy
 * @version 1.0
 * @description: 主方法
 * @date 2024/6/30 02:58
 */
public class Main {
	public static void main(String[] args) {
		ApplicationContext context = new MyselfClassPathXmlApplicationContext("applicationContext.xml");
		System.out.println("=========== main ================");
		JmUser jmUser = (JmUser)context.getBean("jmUser");
		System.out.println(jmUser.getName());
		JmUser jmUserFactory = (JmUser)context.getBean("jmUserFactory");
		System.out.println(jmUserFactory.getName());
		JmUser jmCreateUser = (JmUser)context.getBean("jmCreateUser");
		System.out.println(jmCreateUser.getName());
		// 发布事件
		MyselfEvent event = new MyselfEvent("事件源：source", "This is a custom event");
		context.publishEvent(event);


	}
}